'''
Created on Nov 26, 2010

@author: philip
'''
from models import Link

class AddLinkRequest:
    def __init__(self,title,url,community):
        self.title = title
        self.url = url
        self.community = community

class LinkService:
    def __init__(self):
        pass
    
    def addLink(self,request):
        link = Link()
        link.title = request.title
        link.url = request.url
        link.communityId = request.community
        link.save()
        return link
    
    def getLinks4Community(self,community):
        return Link.objects.filter(communityId=community)